home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 22
/
Cream of the Crop 22.iso
/
program
/
asm32.zip
/
E32.ZIP
/
SETUP.ASM
< prev
next >
Wrap
Assembly Source File
|
1996-03-30
|
6KB
|
384 lines
; SETUP.ASM for E32 - Copyright (C) 1994 - 1996 Douglas Herr
; all rights reserved
; 01/07/1996 DH: made printer_setup a public symbol
; 01/18/1996 DH: changed PICKSTR calls to PICKSTRING
include model.inc
public setup, printer_setup, pick_color
extrn pickstring:near, $tpick:near
extrn tprintce:near
extrn menuoption:near
extrn pickcolor:near
extrn ljsetup:near
extrn strupr:near
extrn strlwr:near
extrn ucursoron:near, getkey:near
extrn cursoroff:near
extrn print_msg:near
public window_mode
extrn swap_files:near
extrn display_screen:near
include dataseg.inc
extrn inverse:byte
extrn nul:byte
extrn display_mode:byte
extrn dirty_bits:byte
extrn saved_pos:dword
msg0 db 'Setup',0
setup_menu label byte
msg1 db 'Multi-file display',0
msg1a db 'File display mode',0
msg2 db 'Screen colors',0
msg3 db 'Printer',0
db 0
setup_dispatch dd window_mode
dd ascii_or_hex
dd pick_color
dd printer_setup
setup_msg dd msg1
dd msg1a
dd msg2
dd msg3
mode_menu db 'ASCII display',0
db 'Hex display',0
db 0
printer_menu label byte
p0 db 'Reset',0
p1 db 'Landscape',0
p2 db 'Lines per inch: '
lpi_len equ $-p2
lpi db '6',0
p3 db 'Compressed',0
db 0
printer_msg dd p0
dd p1
dd p2
dd p3
reset_help db 'Restore setup defaults',0
land_help db 'Landscape page orientation',0
LPI_help db 'Set page lines per inch',0
compressed_help db 'Compressed text',0
help_txt dd reset_help
dd land_help
dd LPI_help
dd compressed_help
lpi_prompt db '1,2,3,4,6 or 8:',0
lpi_prompt_len equ $-lpi_prompt
;
; SCREEN COLORS
;
extrn default_normal:byte
extrn normal:byte, inverse:byte, warning:byte
extrn rows:byte, dirty_bits:byte
extrn window_row:byte
colors label byte
nmsg db 'Normal text',0
pmsg db 'Prompts and Marked blocks',0
wmsg db 'Warnings and Error messages',0
db 0
bgrnd db 'background',0
fgrnd db 'foreground',0
color_ptr dd normal
dd inverse
dd warning
msg_ptr dd nmsg
dd pmsg
dd wmsg
;
; WINDOW MODE
;
extrn rows:byte, window_row:byte
choices db 'Full screen',0
db 'Split screen',0
db 0
two db 'Two screens',0
db 0
@curseg ends
include codeseg.inc
setup proc near
xor ebx,ebx
next_setup:
lea esi,msg0
call print_msg
lea esi,setup_menu
mov dx,0808h
mov eax,offset @curseg:$tpick
call pickstring
jc short setup_exit
cmp ax,27
je short setup_exit
push ebx
shl ebx,2
mov esi,setup_msg[ebx]
call print_msg
call setup_dispatch[ebx]
pop ebx
test dirty_bits,1
jz next_setup
mov saved_pos,-1
call display_screen
jmp next_setup
setup_exit:
ret
setup endp
;
; SCREEN COLORS
;
color_selection equ ebp
pick_color proc near
push ebp
select:
mov dx,0909h
xor ebx,ebx
lea esi,colors
mov eax,offset @curseg:$tpick
call pickstring
jc color_exit
cmp ax,27
je color_exit
or dirty_bits,00100000b
shl ebx,2
mov color_selection,ebx
mov esi,msg_ptr[ebx]
call print_msg
; install trap
lea eax,color_message
mov ebx,7
call menuoption
mov ebx,color_selection
mov ebx,color_ptr[ebx]
mov ah,[ebx] ; get selected color
mov dx,030Ah
call pickcolor
push eax
xor eax,eax
mov ebx,7
call menuoption
mov esi,eax
mov ah,inverse
mov dh,window_row
dec dh
xor dl,dl
call tprintce
pop eax
cmp al,27
je short color_exit
mov ebx,color_selection
mov ebx,color_ptr[ebx]
mov [ebx],ah
lea esi,normal
lea edi,default_normal
mov ecx,3
push ds
pop es
rep movsb
or dirty_bits,1
jmp select
color_message:
pushad
lea esi,bgrnd
test al,al
jz short show_msg
lea esi,fgrnd
show_msg:
mov dh,window_row
dec dh
xor dl,dl
call tprintce
popad
ret
color_exit:
pop ebp
ret
pick_color endp
;
; DISPLAY MODE
;
ascii_or_hex proc near
lea esi,mode_menu
mov dx,0909h
movzx ebx,display_mode ; default: current display mode
shr ebx,2
mov eax,offset @curseg:$tpick
call pickstring
cmp ax,27 ; ESC?
je short ascii_or_hex_exit
shl ebx,2
mov display_mode,bl
or dirty_bits,00100001b
ascii_or_hex_exit:
ret
ascii_or_hex endp
;
; WINDOW MODE
;
window_mode proc near
lea esi,choices
mov dx,0909h
xor ebx,ebx ; first choice
mov eax,offset @curseg:$tpick
call pickstring
cmp ax,27 ; ESC?
je short window_mode_exit ; exit
cmp ebx,1
sbb eax,eax ; 0 if split, -1 if full
not eax
and al,rows
shr al,1
inc al
xor ebx,ebx
inc ebx
mov window_row,al
push ebx
call swap_files
pop ebx
call swap_files
or dirty_bits,00100001b
push ds
pop es
window_mode_exit:
ret
window_mode endp
printer_setup:
; enable help messages
mov ebx,7
lea eax,print_setup_help_proc
call menuoption
xor ebx,ebx
lea esi,printer_menu
mov dx,0909h
mov eax,offset @curseg:$tpick
call pickstring
; disable options
push eax
push ebx
mov ebx,5
xor eax,eax
call menuoption
mov ebx,7
call menuoption
pop ebx
pop eax
cmp ax,27
je printer_setup_exit
cmp bx,2 ; lines per inch?
jne short p5
pf3:
lea esi,p2
call print_msg
add dl,lpi_len
lea esi,lpi_prompt
call tprintce
add dl,lpi_prompt_len
call ucursoron
call getkey
call cursoroff
cmp ax,27
je short p6
cmp ax,'1'
jb pf3
cmp ax,'5'
jb short p4
je pf3
cmp ax,'8'
ja pf3
je short p4
cmp ax,'7'
je pf3
p4:
mov lpi,al
lea esi,msg3
call print_msg
mov bx,2
p5:
movzx ebx,bx
call ljsetup
or ebx,ebx
jnz short printer_flag_on
; turn all flags off
mov ecx,4
lea esi,printer_msg
printer_flags_off:
push ecx
mov ebx,[esi]
add esi,4
inc ebx
call strlwr
pop ecx
loop printer_flags_off
mov lpi,'6'
jmp printer_setup
printer_flag_on:
push ebx
mov ebx,printer_msg[ebx*4]
call strupr
pop ebx
p6:
jmp printer_setup
printer_setup_exit:
ret
print_setup_help_proc:
mov esi,help_txt[ebx*4]
jmp print_msg
@curseg ends
end